package com.hc.wdj.servlet.model;

import com.hc.wdj.core.application.ApplicationInfo;
import com.hc.wdj.core.context.model.HcRequest;

import javax.servlet.http.HttpServletRequest;

/**
 * @author ryanwdj
 * @since 2024/11/14
 */
public class HcRequestForServlet implements HcRequest {

    protected HttpServletRequest request;

    public HcRequestForServlet(HttpServletRequest request){
        this.request = request;
    }

    @Override
    public Object getSource() {
        return request;
    }

    @Override
    public String getParam(String name) {
        return request.getParameter(name);
    }

    @Override
    public String getRequestPath() {
        return ApplicationInfo.cutPathPrefix(request.getRequestURI());
    }

    @Override
    public String getHeader(String name) {
        return request.getHeader(name);
    }
}
